import QtQuick 2.7
import QtQuick.Controls 2.1
Item {
    width: frmWindow.width;
    height: frmWindow.height;
    Rectangle
    {
        id:headerTop;
        width: parent.width;
        height: dp(30);
        color: "#ff6565";
        z:6;
        //左边后退按钮
        Text
        {
            font.family: "FontAwesome";
            text: "\uf104";
            font.pixelSize: dp(24);
            color: "white";
            anchors.verticalCenter: parent.verticalCenter;
            leftPadding: dp(10);
        }
        //右边搜索按钮
        Text
        {

            font.family: "FontAwesome";
            text: "\uf002";
            font.pixelSize: dp(16);
            color: "white";
            anchors.verticalCenter: parent.verticalCenter;
            anchors.right: parent.right;
            rightPadding: dp(10);
            font.bold: false;
        }
        Rectangle
        {

            width: parent.width/2.5;
            height: parent.height/1.4;
            anchors.centerIn: parent;
            color: "#ff8a8a";
            TabBar
            {
                id:messageTab;
                height: parent.height/1.3;
                anchors.centerIn: parent;
                width: parent.width/1.15;
                Repeater
                {
                    model: ["消息","通知"]
                    TabButton
                    {
//                        text:modelData;
                        height: messageTab.height;
                        Rectangle
                        {
                            height: parent.height;
                            width: messageTab.width/1.9;
                            color: "#ff8a8a";
                            z:1;
                        }
                        contentItem: Text
                        {
                            text:modelData;
                            color:(messageTab.currentIndex==index)?"#ff6565":"#fff8f8";
                            horizontalAlignment: Text.AlignHCenter
                            verticalAlignment: Text.AlignVCenter
                            z:2;
                        }
                        background: Rectangle
                        {
                            color:(messageTab.currentIndex==index)?"#ffd0d0":"#ff8a8a";
                            radius:(messageTab.currentIndex==index)?dp(2):0;
                            z:2;
                        }

                    }

                }
            }
        }

    }

    SwipeView
    {
        id:messageSwipe;
        currentIndex: messageTab.currentIndex;
        anchors.top:headerTop.bottom;
        interactive: false;
        width: parent.width;
        height: frmWindow.height - bar.height
        Rectangle
        {
           Loader
           {
               active:true;
               source: "user_message_list.qml";
           }
        }
        Rectangle
        {
            Text
            {
                text:"456";
            }
        }
    }
}
